<template>
  <div class="pagination" :class="nobg?'nobg':''" ref="pagination">
    <el-pagination layout="prev, pager, next" @current-change="currentChange" @change="changePage" :current-page="current" :total="total" :pager-count="count" />
  </div>
</template>
<script setup>
const props=defineProps({
  total:{
    type:Number,
    required:true
  },
  currentPage:{
    type:Number,
    default:1
  },
  count:{
    type:Number,
    required:true
  },
  nobg:{
    type:Boolean,
    default:false
  }
});
const emit=defineEmits(['change']);
const current=ref(props.currentPage);
const currentChange=(p)=>{
  current.value=p;
};
watch(
  () => props.currentPage,
  (n, o) => {
    current.value=n;
  }
);
const changePage=(e)=>{
  emit('change',e);
};
</script>
